<script>
	import Vue from 'vue'
	export default {
		onLaunch: function() {
			uni.hideTabBar()
			
			uni.$store = this.$store
			
			var that = this
			this.$store.dispatch('openSocket')
			
			this.$Http({
				url: 'getShareConfig'
			}).then(res => {
				if (res.code == 1) {
					that.$store.commit('setShareConfig', res.data)
				}
			})

			// #ifdef MP-WEIXIN
			// 获取用户信息
			wx.getSetting({
				success: res => {
					if (res.authSetting['scope.userInfo']) {
						// 已经授权，可以直接调用 getUserInfo 获取头像昵称，不会弹框
						wx.getUserInfo({
							success: res => {
								uni.setStorage({
									key: 'userInfo',
									data: res.userInfo,
								})
							}
						})
					} else {
						// 没有授权
						uni.navigateTo({
							url: '/pagesA/common/auth?Signin=false',
						})
					}
				}
			})
			// #endif

			uni.getSystemInfo({
				success:function(e){
					// 状态栏的高度
					Vue.prototype.statusBar = e.statusBarHeight

					// 状态栏 + 胶囊的高度
					if(e.platform == 'android') {
						Vue.prototype.customBarHeight = e.statusBarHeight + 50
					} else if(e.platform == 'ios') {
						Vue.prototype.customBarHeight = e.statusBarHeight + 45
					}

					// #ifdef MP-WEIXIN
					let custom = wx.getMenuButtonBoundingClientRect()
					Vue.prototype.customBarWidth = custom.left
					Vue.prototype.customBarHeight = custom.bottom + custom.top - e.statusBarHeight
					// #endif
				}
			})
		},
		onShow: function() {
			// wx.hideTabBar()
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-ui/index.scss";
</style>
<style lang="less">
	/* common.cs每个页面公共css */
	@import '@/common/css/common.less';
	
	.mr-{
		&10{margin-right: 10rpx;}
		&20{margin-right: 20rpx;}
		&30{margin-right: 30rpx;}
	}
	.text-success{
		color: #25b40f;
	}
	.text-info{
		color: #4879fd;
	}
	.text-warning{
		color: #eb8b1e;
	}
	.text-danger{
		color: #e34b14;
	}
	

	/* 药品用量默认组件样式 */
	.drugs-edit{
		.form-box{
			.item{
				/* uni-number-box */
				.uni-numbox{width: 176rpx;height: 56rpx;line-height: 54rpx;margin-right: 20rpx;}
				.uni-numbox__value {width: 82rpx;height: 56rpx;font-size: 28rpx;border: 1rpx solid #dcdcdc;}
				.uni-numbox__minus,.uni-numbox__plus {width: 46rpx;height: 56rpx;line-height: 54rpx; background-color: #fff;border: 1rpx solid #dcdcdc;}
				.uni-numbox__minus {border-right: none;border-radius: 10rpx 0 0 10rpx;}
				.uni-numbox__plus {border-left: none;border-radius: 0 10rpx 10rpx 0;}
				.uni-numbox--text {font-size: 20px;color: #bfbfbf;line-height: 54rpx;}
			}
		}
	}
</style>
